<#assign pageName="">
<@override name="page-content">	
<form class="layui-form form-horizontal" role="form" method="post">   
      <div class="layui-form-search panel">
      	 <input type="text" hidden="hidden" name="_STATE"/> 
      	 <div class="layui-form-item margin-5">
	      <label class="layui-form-label" for="${id}">所属部门</label>
	      <div class="layui-input-inline">
	          <select id="depId" class="width-190" name="depId"  lay-filter="depId">
	            <#if depList?has_content>
	               <option value="">—请选择所属部门—</option>
	              <#list depList as Item>
	                <option value="${Item.depId}">${Item.depName}</option>
	              </#list>
	            </#if>
	          </select>
	      </div>
	  </div>
         <div class="pull-left padding-5"> 
	          <a href="javascript:" onclick="$('form:first').submit();" class="layui-btn layui-btn-sm">
                <i class="layui-icon layui-icon-search"></i>查询
            </a>
            <a href="javascript:" class="layui-btn layui-btn-warm layui-btn-sm js-reset">
                <i class="layui-icon layui-icon-refresh-1"></i>重置
            </a>
            <a id="sub" href="javaScript:;" onclick="subCheck()" class="layui-btn layui-btn-sm"  >
                <i class="layui-icon layui-icon-addition"></i>提交
            </a>           
    	</div>
      </div>
	 <table class="layui-table" id="meeting">		
			<thead>
                <tr>
                     <th class="align-center" width="50px" nowrap="nowrap">序号</th>
                     <th class="align-center" nowrap="nowrap">用户名称</th>
                     <th class="align-center">创建时间</th>
                     <th class="align-center">状态</th>
                     <th class="align-center" width="150px">
                        <input type="checkbox" class="fullCheck" lay-skin="primary" lay-filter="fullCheck">
                     </th>
                 </tr>
             </thead>
             <tbody>
                 <#if userList?has_content>
                     <#list userList as dataItem>
                     <tr>
                         <td class="align-center" width="50px" nowrap="nowrap">
                             ${(pageNo-1)*pageSize+dataItem_index+1}
                         </td>
                         <td class="align-center" nowrap="nowrap">
                             ${dataItem.uname}
                         </td>
                         <td class="align-center">
                             <span>${(dataItem.indate)?date}</span>               
                         </td>
                         <td class="align-center" nowrap="nowrap">
                             <#if dataItem.enable?string == "T">
                                 <span class="layui-bg-green status-show">启用</span>
                             <#else>
                                 <span class="layui-bg-red status-show">禁用</span>
                             </#if>
                         </td>
                         <td class="align-center" nowrap="nowrap">
                             <#if dataItem.pwdConfirm?string == "1">      		
		                         <input type="checkbox" lay-skin="primary" lay-filter="userItem" class="userItem" checked="checked" value="${dataItem.userId},${dataItem.uname}"/>
                             <#else>
                                 <input type="checkbox" lay-skin="primary" lay-filter="userItem" class="userItem" value="${dataItem.userId},${dataItem.uname}"/>
                             </#if>
                         </td>
					</tr>
				</#list>
			<#else>
				<tr class="align-center">
					<td style="color:red;font-weight:bold;" colspan="7">暂无符合条件的信息</td>
				</tr>
			</#if>
			</tbody>
		</table>				
</form>
</@override>
<@override name="page-scripts">
<script>
        var userArray = [];
		$(function(){
		    layui.use(['form','layer','element', 'jquery'], function(){
		        var form=layui.form;
		        var layer=layui.layer;
		        var element = layui.element;
		        var $ = layui.jquery;
		        form.on('checkbox(fullCheck)', function (data) {
		        	userArray.splice(0, userArray.length);
	                if(this.checked){
	                    $('.userItem').each(function(index, item){
	                        item.checked = data.elem.checked;
	                        var itemValue = $(this).val();
	                        if($.inArray(itemValue, userArray) == -1){
	                        	userArray.push(itemValue);
	                        }
	                    });
	                }else{
	                    $('.userItem').each(function(index, item){
	                        item.checked = data.elem.checked;
	                    });
	                }
	                form.render('checkbox');
	            });
	            form.on('checkbox(itemCheck)', function (data) {
	                if(this.checked){
	                	userArray.push(data.value);
	                }else{
	                	userArray.splice(userArray.indexOf(data.value),1);
	                }
	            });
		        $('.js-reset').on('click', function(){
		            $('#pageNo').val(1);
		            $('#sponsorDid').val("");
		            $('form:first').submit();
		        });
		    })
		})
     function subCheck(){
         var dataId = [];
         var dataName = [];
         $.each($("#meeting > tbody > tr > td input[type=checkbox]"),function(index,item){             
             if($(item).prop('checked')){
                 if($(item).val()!=null&&$(item).val()!==""&&$(item).val()!==undefined) {
                     var data = $(item).val().split(",");
                     dataId.push(data[0]);
                     dataName.push(data[1]);
                 }
             }          
         }); 
         var id = "";
         var name = "";
         for(var i = 0; i < dataId.length; i++){
                if( i== 0){
                    id=dataId[i];
                    name=dataName[i];
                }else{
                    id=id+","+dataId[i];
                    name= name + "," +dataName[i];
                }
            }
         window.parent.shareU(id,name);
         var index = parent.layer.getFrameIndex(window.name); 
         parent.layer.close(index);
     };
    </script>
</@override>
<@extends name="/layout/basepage.html"/> 
